using System; 
using System.Text; 
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration; 
using System.Xml; 
using System.Xml.Serialization;
using SubSonic; 
using SubSonic.Utilities;
namespace Medianamik.Core.DAL.SubSonicDAL
{
	/// <summary>
	/// Strongly-typed collection for the User class.
	/// </summary>
    [Serializable]
	public partial class UserCollection : ActiveList<User, UserCollection>
	{	   
		public UserCollection() {}
        
        /// <summary>
		/// Filters an existing collection based on the set criteria. This is an in-memory filter
		/// Thanks to developingchris for this!
        /// </summary>
        /// <returns>UserCollection</returns>
		public UserCollection Filter()
        {
            for (int i = this.Count - 1; i > -1; i--)
            {
                User o = this[i];
                foreach (SubSonic.Where w in this.wheres)
                {
                    bool remove = false;
                    System.Reflection.PropertyInfo pi = o.GetType().GetProperty(w.ColumnName);
                    if (pi.CanRead)
                    {
                        object val = pi.GetValue(o, null);
                        switch (w.Comparison)
                        {
                            case SubSonic.Comparison.Equals:
                                if (!val.Equals(w.ParameterValue))
                                {
                                    remove = true;
                                }
                                break;
                        }
                    }
                    if (remove)
                    {
                        this.Remove(o);
                        break;
                    }
                }
            }
            return this;
        }
		
		
	}
	/// <summary>
	/// This is an ActiveRecord class which wraps the medianamik_User table.
	/// </summary>
	[Serializable]
	public partial class User : ActiveRecord<User>, IActiveRecord
	{
		#region .ctors and Default Settings
		
		public User()
		{
		  SetSQLProps();
		  InitSetDefaults();
		  MarkNew();
		}
		
		private void InitSetDefaults() { SetDefaults(); }
		
		public User(bool useDatabaseDefaults)
		{
			SetSQLProps();
			if(useDatabaseDefaults)
				ForceDefaults();
			MarkNew();
		}
        
		public User(object keyID)
		{
			SetSQLProps();
			InitSetDefaults();
			LoadByKey(keyID);
		}
		 
		public User(string columnName, object columnValue)
		{
			SetSQLProps();
			InitSetDefaults();
			LoadByParam(columnName,columnValue);
		}
		
		protected static void SetSQLProps() { GetTableSchema(); }
		
		#endregion
		
		#region Schema and Query Accessor	
		public static Query CreateQuery() { return new Query(Schema); }
		public static TableSchema.Table Schema
		{
			get
			{
				if (BaseSchema == null)
					SetSQLProps();
				return BaseSchema;
			}
		}
		
		private static void GetTableSchema() 
		{
			if(!IsSchemaInitialized)
			{
				//Schema declaration
				TableSchema.Table schema = new TableSchema.Table("medianamik_User", TableType.Table, DataService.GetInstance("MedianamikProvider"));
				schema.Columns = new TableSchema.TableColumnCollection();
				schema.SchemaName = @"dbo";
				//columns
				
				TableSchema.TableColumn colvarUserId = new TableSchema.TableColumn(schema);
				colvarUserId.ColumnName = "UserId";
				colvarUserId.DataType = DbType.Guid;
				colvarUserId.MaxLength = 0;
				colvarUserId.AutoIncrement = false;
				colvarUserId.IsNullable = false;
				colvarUserId.IsPrimaryKey = true;
				colvarUserId.IsForeignKey = false;
				colvarUserId.IsReadOnly = false;
				colvarUserId.DefaultSetting = @"";
				colvarUserId.ForeignKeyTableName = "";
				schema.Columns.Add(colvarUserId);
				
				TableSchema.TableColumn colvarName = new TableSchema.TableColumn(schema);
				colvarName.ColumnName = "Name";
				colvarName.DataType = DbType.String;
				colvarName.MaxLength = 256;
				colvarName.AutoIncrement = false;
				colvarName.IsNullable = false;
				colvarName.IsPrimaryKey = false;
				colvarName.IsForeignKey = false;
				colvarName.IsReadOnly = false;
				colvarName.DefaultSetting = @"";
				colvarName.ForeignKeyTableName = "";
				schema.Columns.Add(colvarName);
				
				TableSchema.TableColumn colvarLastLockedOutDate = new TableSchema.TableColumn(schema);
				colvarLastLockedOutDate.ColumnName = "LastLockedOutDate";
				colvarLastLockedOutDate.DataType = DbType.DateTime;
				colvarLastLockedOutDate.MaxLength = 0;
				colvarLastLockedOutDate.AutoIncrement = false;
				colvarLastLockedOutDate.IsNullable = true;
				colvarLastLockedOutDate.IsPrimaryKey = false;
				colvarLastLockedOutDate.IsForeignKey = false;
				colvarLastLockedOutDate.IsReadOnly = false;
				colvarLastLockedOutDate.DefaultSetting = @"";
				colvarLastLockedOutDate.ForeignKeyTableName = "";
				schema.Columns.Add(colvarLastLockedOutDate);
				
				TableSchema.TableColumn colvarIsLockedOut = new TableSchema.TableColumn(schema);
				colvarIsLockedOut.ColumnName = "IsLockedOut";
				colvarIsLockedOut.DataType = DbType.Boolean;
				colvarIsLockedOut.MaxLength = 0;
				colvarIsLockedOut.AutoIncrement = false;
				colvarIsLockedOut.IsNullable = false;
				colvarIsLockedOut.IsPrimaryKey = false;
				colvarIsLockedOut.IsForeignKey = false;
				colvarIsLockedOut.IsReadOnly = false;
				colvarIsLockedOut.DefaultSetting = @"";
				colvarIsLockedOut.ForeignKeyTableName = "";
				schema.Columns.Add(colvarIsLockedOut);
				
				TableSchema.TableColumn colvarPasswordQuestion = new TableSchema.TableColumn(schema);
				colvarPasswordQuestion.ColumnName = "PasswordQuestion";
				colvarPasswordQuestion.DataType = DbType.String;
				colvarPasswordQuestion.MaxLength = 256;
				colvarPasswordQuestion.AutoIncrement = false;
				colvarPasswordQuestion.IsNullable = true;
				colvarPasswordQuestion.IsPrimaryKey = false;
				colvarPasswordQuestion.IsForeignKey = false;
				colvarPasswordQuestion.IsReadOnly = false;
				colvarPasswordQuestion.DefaultSetting = @"";
				colvarPasswordQuestion.ForeignKeyTableName = "";
				schema.Columns.Add(colvarPasswordQuestion);
				
				TableSchema.TableColumn colvarPasswordAnswer = new TableSchema.TableColumn(schema);
				colvarPasswordAnswer.ColumnName = "PasswordAnswer";
				colvarPasswordAnswer.DataType = DbType.String;
				colvarPasswordAnswer.MaxLength = 128;
				colvarPasswordAnswer.AutoIncrement = false;
				colvarPasswordAnswer.IsNullable = true;
				colvarPasswordAnswer.IsPrimaryKey = false;
				colvarPasswordAnswer.IsForeignKey = false;
				colvarPasswordAnswer.IsReadOnly = false;
				colvarPasswordAnswer.DefaultSetting = @"";
				colvarPasswordAnswer.ForeignKeyTableName = "";
				schema.Columns.Add(colvarPasswordAnswer);
				
				TableSchema.TableColumn colvarComment = new TableSchema.TableColumn(schema);
				colvarComment.ColumnName = "Comment";
				colvarComment.DataType = DbType.String;
				colvarComment.MaxLength = 256;
				colvarComment.AutoIncrement = false;
				colvarComment.IsNullable = true;
				colvarComment.IsPrimaryKey = false;
				colvarComment.IsForeignKey = false;
				colvarComment.IsReadOnly = false;
				colvarComment.DefaultSetting = @"";
				colvarComment.ForeignKeyTableName = "";
				schema.Columns.Add(colvarComment);
				
				TableSchema.TableColumn colvarLastPasswordChangedDate = new TableSchema.TableColumn(schema);
				colvarLastPasswordChangedDate.ColumnName = "LastPasswordChangedDate";
				colvarLastPasswordChangedDate.DataType = DbType.DateTime;
				colvarLastPasswordChangedDate.MaxLength = 0;
				colvarLastPasswordChangedDate.AutoIncrement = false;
				colvarLastPasswordChangedDate.IsNullable = true;
				colvarLastPasswordChangedDate.IsPrimaryKey = false;
				colvarLastPasswordChangedDate.IsForeignKey = false;
				colvarLastPasswordChangedDate.IsReadOnly = false;
				colvarLastPasswordChangedDate.DefaultSetting = @"";
				colvarLastPasswordChangedDate.ForeignKeyTableName = "";
				schema.Columns.Add(colvarLastPasswordChangedDate);
				
				TableSchema.TableColumn colvarIsApproved = new TableSchema.TableColumn(schema);
				colvarIsApproved.ColumnName = "IsApproved";
				colvarIsApproved.DataType = DbType.Boolean;
				colvarIsApproved.MaxLength = 0;
				colvarIsApproved.AutoIncrement = false;
				colvarIsApproved.IsNullable = false;
				colvarIsApproved.IsPrimaryKey = false;
				colvarIsApproved.IsForeignKey = false;
				colvarIsApproved.IsReadOnly = false;
				colvarIsApproved.DefaultSetting = @"";
				colvarIsApproved.ForeignKeyTableName = "";
				schema.Columns.Add(colvarIsApproved);
				
				TableSchema.TableColumn colvarLastLoginDate = new TableSchema.TableColumn(schema);
				colvarLastLoginDate.ColumnName = "LastLoginDate";
				colvarLastLoginDate.DataType = DbType.DateTime;
				colvarLastLoginDate.MaxLength = 0;
				colvarLastLoginDate.AutoIncrement = false;
				colvarLastLoginDate.IsNullable = true;
				colvarLastLoginDate.IsPrimaryKey = false;
				colvarLastLoginDate.IsForeignKey = false;
				colvarLastLoginDate.IsReadOnly = false;
				colvarLastLoginDate.DefaultSetting = @"";
				colvarLastLoginDate.ForeignKeyTableName = "";
				schema.Columns.Add(colvarLastLoginDate);
				
				TableSchema.TableColumn colvarLastActivityDate = new TableSchema.TableColumn(schema);
				colvarLastActivityDate.ColumnName = "LastActivityDate";
				colvarLastActivityDate.DataType = DbType.DateTime;
				colvarLastActivityDate.MaxLength = 0;
				colvarLastActivityDate.AutoIncrement = false;
				colvarLastActivityDate.IsNullable = true;
				colvarLastActivityDate.IsPrimaryKey = false;
				colvarLastActivityDate.IsForeignKey = false;
				colvarLastActivityDate.IsReadOnly = false;
				colvarLastActivityDate.DefaultSetting = @"";
				colvarLastActivityDate.ForeignKeyTableName = "";
				schema.Columns.Add(colvarLastActivityDate);
				
				TableSchema.TableColumn colvarEmail = new TableSchema.TableColumn(schema);
				colvarEmail.ColumnName = "Email";
				colvarEmail.DataType = DbType.String;
				colvarEmail.MaxLength = 256;
				colvarEmail.AutoIncrement = false;
				colvarEmail.IsNullable = false;
				colvarEmail.IsPrimaryKey = false;
				colvarEmail.IsForeignKey = false;
				colvarEmail.IsReadOnly = false;
				colvarEmail.DefaultSetting = @"";
				colvarEmail.ForeignKeyTableName = "";
				schema.Columns.Add(colvarEmail);
				
				TableSchema.TableColumn colvarCreatedOn = new TableSchema.TableColumn(schema);
				colvarCreatedOn.ColumnName = "CreatedOn";
				colvarCreatedOn.DataType = DbType.DateTime;
				colvarCreatedOn.MaxLength = 0;
				colvarCreatedOn.AutoIncrement = false;
				colvarCreatedOn.IsNullable = false;
				colvarCreatedOn.IsPrimaryKey = false;
				colvarCreatedOn.IsForeignKey = false;
				colvarCreatedOn.IsReadOnly = false;
				colvarCreatedOn.DefaultSetting = @"";
				colvarCreatedOn.ForeignKeyTableName = "";
				schema.Columns.Add(colvarCreatedOn);
				
				TableSchema.TableColumn colvarPassword = new TableSchema.TableColumn(schema);
				colvarPassword.ColumnName = "Password";
				colvarPassword.DataType = DbType.String;
				colvarPassword.MaxLength = 512;
				colvarPassword.AutoIncrement = false;
				colvarPassword.IsNullable = false;
				colvarPassword.IsPrimaryKey = false;
				colvarPassword.IsForeignKey = false;
				colvarPassword.IsReadOnly = false;
				colvarPassword.DefaultSetting = @"";
				colvarPassword.ForeignKeyTableName = "";
				schema.Columns.Add(colvarPassword);
				
				TableSchema.TableColumn colvarSalt = new TableSchema.TableColumn(schema);
				colvarSalt.ColumnName = "Salt";
				colvarSalt.DataType = DbType.String;
				colvarSalt.MaxLength = 128;
				colvarSalt.AutoIncrement = false;
				colvarSalt.IsNullable = false;
				colvarSalt.IsPrimaryKey = false;
				colvarSalt.IsForeignKey = false;
				colvarSalt.IsReadOnly = false;
				colvarSalt.DefaultSetting = @"";
				colvarSalt.ForeignKeyTableName = "";
				schema.Columns.Add(colvarSalt);
				
				TableSchema.TableColumn colvarPasswordFormat = new TableSchema.TableColumn(schema);
				colvarPasswordFormat.ColumnName = "PasswordFormat";
				colvarPasswordFormat.DataType = DbType.Int32;
				colvarPasswordFormat.MaxLength = 0;
				colvarPasswordFormat.AutoIncrement = false;
				colvarPasswordFormat.IsNullable = false;
				colvarPasswordFormat.IsPrimaryKey = false;
				colvarPasswordFormat.IsForeignKey = false;
				colvarPasswordFormat.IsReadOnly = false;
				colvarPasswordFormat.DefaultSetting = @"";
				colvarPasswordFormat.ForeignKeyTableName = "";
				schema.Columns.Add(colvarPasswordFormat);
				
				BaseSchema = schema;
				//add this schema to the provider
				//so we can query it later
				DataService.Providers["MedianamikProvider"].AddSchema("medianamik_User",schema);
			}
		}
		#endregion
		
		#region Props
		  
		[XmlAttribute("UserId")]
		[Bindable(true)]
		public Guid UserId 
		{
			get { return GetColumnValue<Guid>(Columns.UserId); }
			set { SetColumnValue(Columns.UserId, value); }
		}
		  
		[XmlAttribute("Name")]
		[Bindable(true)]
		public string Name 
		{
			get { return GetColumnValue<string>(Columns.Name); }
			set { SetColumnValue(Columns.Name, value); }
		}
		  
		[XmlAttribute("LastLockedOutDate")]
		[Bindable(true)]
		public DateTime? LastLockedOutDate 
		{
			get { return GetColumnValue<DateTime?>(Columns.LastLockedOutDate); }
			set { SetColumnValue(Columns.LastLockedOutDate, value); }
		}
		  
		[XmlAttribute("IsLockedOut")]
		[Bindable(true)]
		public bool IsLockedOut 
		{
			get { return GetColumnValue<bool>(Columns.IsLockedOut); }
			set { SetColumnValue(Columns.IsLockedOut, value); }
		}
		  
		[XmlAttribute("PasswordQuestion")]
		[Bindable(true)]
		public string PasswordQuestion 
		{
			get { return GetColumnValue<string>(Columns.PasswordQuestion); }
			set { SetColumnValue(Columns.PasswordQuestion, value); }
		}
		  
		[XmlAttribute("PasswordAnswer")]
		[Bindable(true)]
		public string PasswordAnswer 
		{
			get { return GetColumnValue<string>(Columns.PasswordAnswer); }
			set { SetColumnValue(Columns.PasswordAnswer, value); }
		}
		  
		[XmlAttribute("Comment")]
		[Bindable(true)]
		public string Comment 
		{
			get { return GetColumnValue<string>(Columns.Comment); }
			set { SetColumnValue(Columns.Comment, value); }
		}
		  
		[XmlAttribute("LastPasswordChangedDate")]
		[Bindable(true)]
		public DateTime? LastPasswordChangedDate 
		{
			get { return GetColumnValue<DateTime?>(Columns.LastPasswordChangedDate); }
			set { SetColumnValue(Columns.LastPasswordChangedDate, value); }
		}
		  
		[XmlAttribute("IsApproved")]
		[Bindable(true)]
		public bool IsApproved 
		{
			get { return GetColumnValue<bool>(Columns.IsApproved); }
			set { SetColumnValue(Columns.IsApproved, value); }
		}
		  
		[XmlAttribute("LastLoginDate")]
		[Bindable(true)]
		public DateTime? LastLoginDate 
		{
			get { return GetColumnValue<DateTime?>(Columns.LastLoginDate); }
			set { SetColumnValue(Columns.LastLoginDate, value); }
		}
		  
		[XmlAttribute("LastActivityDate")]
		[Bindable(true)]
		public DateTime? LastActivityDate 
		{
			get { return GetColumnValue<DateTime?>(Columns.LastActivityDate); }
			set { SetColumnValue(Columns.LastActivityDate, value); }
		}
		  
		[XmlAttribute("Email")]
		[Bindable(true)]
		public string Email 
		{
			get { return GetColumnValue<string>(Columns.Email); }
			set { SetColumnValue(Columns.Email, value); }
		}
		  
		[XmlAttribute("CreatedOn")]
		[Bindable(true)]
		public DateTime CreatedOn 
		{
			get { return GetColumnValue<DateTime>(Columns.CreatedOn); }
			set { SetColumnValue(Columns.CreatedOn, value); }
		}
		  
		[XmlAttribute("Password")]
		[Bindable(true)]
		public string Password 
		{
			get { return GetColumnValue<string>(Columns.Password); }
			set { SetColumnValue(Columns.Password, value); }
		}
		  
		[XmlAttribute("Salt")]
		[Bindable(true)]
		public string Salt 
		{
			get { return GetColumnValue<string>(Columns.Salt); }
			set { SetColumnValue(Columns.Salt, value); }
		}
		  
		[XmlAttribute("PasswordFormat")]
		[Bindable(true)]
		public int PasswordFormat 
		{
			get { return GetColumnValue<int>(Columns.PasswordFormat); }
			set { SetColumnValue(Columns.PasswordFormat, value); }
		}
		
		#endregion
		
		
		#region PrimaryKey Methods		
		
        protected override void SetPrimaryKey(object oValue)
        {
            base.SetPrimaryKey(oValue);
            
            SetPKValues();
        }
        
		
		private Medianamik.Core.DAL.SubSonicDAL.UserInGroupCollection colUserInGroupRecords;
		public Medianamik.Core.DAL.SubSonicDAL.UserInGroupCollection UserInGroupRecords()
		{
			if(colUserInGroupRecords == null)
			{
				colUserInGroupRecords = new Medianamik.Core.DAL.SubSonicDAL.UserInGroupCollection().Where(UserInGroup.Columns.UserId, UserId).Load();
				colUserInGroupRecords.ListChanged += new ListChangedEventHandler(colUserInGroupRecords_ListChanged);
			}
			return colUserInGroupRecords;
		}
				
		void colUserInGroupRecords_ListChanged(object sender, ListChangedEventArgs e)
		{
            if (e.ListChangedType == ListChangedType.ItemAdded)
            {
		        // Set foreign key value
		        colUserInGroupRecords[e.NewIndex].UserId = UserId;
				colUserInGroupRecords.ListChanged += new ListChangedEventHandler(colUserInGroupRecords_ListChanged);
            }
		}
		#endregion
		
			
		
		//no foreign key tables defined (0)
		
		
		
		//no ManyToMany tables defined (0)
		
        
        
		#region ObjectDataSource support
		
		
		/// <summary>
		/// Inserts a record, can be used with the Object Data Source
		/// </summary>
		public static void Insert(Guid varUserId,string varName,DateTime? varLastLockedOutDate,bool varIsLockedOut,string varPasswordQuestion,string varPasswordAnswer,string varComment,DateTime? varLastPasswordChangedDate,bool varIsApproved,DateTime? varLastLoginDate,DateTime? varLastActivityDate,string varEmail,DateTime varCreatedOn,string varPassword,string varSalt,int varPasswordFormat)
		{
			User item = new User();
			
			item.UserId = varUserId;
			
			item.Name = varName;
			
			item.LastLockedOutDate = varLastLockedOutDate;
			
			item.IsLockedOut = varIsLockedOut;
			
			item.PasswordQuestion = varPasswordQuestion;
			
			item.PasswordAnswer = varPasswordAnswer;
			
			item.Comment = varComment;
			
			item.LastPasswordChangedDate = varLastPasswordChangedDate;
			
			item.IsApproved = varIsApproved;
			
			item.LastLoginDate = varLastLoginDate;
			
			item.LastActivityDate = varLastActivityDate;
			
			item.Email = varEmail;
			
			item.CreatedOn = varCreatedOn;
			
			item.Password = varPassword;
			
			item.Salt = varSalt;
			
			item.PasswordFormat = varPasswordFormat;
			
		
			if (System.Web.HttpContext.Current != null)
				item.Save(System.Web.HttpContext.Current.User.Identity.Name);
			else
				item.Save(System.Threading.Thread.CurrentPrincipal.Identity.Name);
		}
		
		/// <summary>
		/// Updates a record, can be used with the Object Data Source
		/// </summary>
		public static void Update(Guid varUserId,string varName,DateTime? varLastLockedOutDate,bool varIsLockedOut,string varPasswordQuestion,string varPasswordAnswer,string varComment,DateTime? varLastPasswordChangedDate,bool varIsApproved,DateTime? varLastLoginDate,DateTime? varLastActivityDate,string varEmail,DateTime varCreatedOn,string varPassword,string varSalt,int varPasswordFormat)
		{
			User item = new User();
			
				item.UserId = varUserId;
			
				item.Name = varName;
			
				item.LastLockedOutDate = varLastLockedOutDate;
			
				item.IsLockedOut = varIsLockedOut;
			
				item.PasswordQuestion = varPasswordQuestion;
			
				item.PasswordAnswer = varPasswordAnswer;
			
				item.Comment = varComment;
			
				item.LastPasswordChangedDate = varLastPasswordChangedDate;
			
				item.IsApproved = varIsApproved;
			
				item.LastLoginDate = varLastLoginDate;
			
				item.LastActivityDate = varLastActivityDate;
			
				item.Email = varEmail;
			
				item.CreatedOn = varCreatedOn;
			
				item.Password = varPassword;
			
				item.Salt = varSalt;
			
				item.PasswordFormat = varPasswordFormat;
			
			item.IsNew = false;
			if (System.Web.HttpContext.Current != null)
				item.Save(System.Web.HttpContext.Current.User.Identity.Name);
			else
				item.Save(System.Threading.Thread.CurrentPrincipal.Identity.Name);
		}
		#endregion
        
        
        
        #region Typed Columns
        
        
        public static TableSchema.TableColumn UserIdColumn
        {
            get { return Schema.Columns[0]; }
        }
        
        
        
        public static TableSchema.TableColumn NameColumn
        {
            get { return Schema.Columns[1]; }
        }
        
        
        
        public static TableSchema.TableColumn LastLockedOutDateColumn
        {
            get { return Schema.Columns[2]; }
        }
        
        
        
        public static TableSchema.TableColumn IsLockedOutColumn
        {
            get { return Schema.Columns[3]; }
        }
        
        
        
        public static TableSchema.TableColumn PasswordQuestionColumn
        {
            get { return Schema.Columns[4]; }
        }
        
        
        
        public static TableSchema.TableColumn PasswordAnswerColumn
        {
            get { return Schema.Columns[5]; }
        }
        
        
        
        public static TableSchema.TableColumn CommentColumn
        {
            get { return Schema.Columns[6]; }
        }
        
        
        
        public static TableSchema.TableColumn LastPasswordChangedDateColumn
        {
            get { return Schema.Columns[7]; }
        }
        
        
        
        public static TableSchema.TableColumn IsApprovedColumn
        {
            get { return Schema.Columns[8]; }
        }
        
        
        
        public static TableSchema.TableColumn LastLoginDateColumn
        {
            get { return Schema.Columns[9]; }
        }
        
        
        
        public static TableSchema.TableColumn LastActivityDateColumn
        {
            get { return Schema.Columns[10]; }
        }
        
        
        
        public static TableSchema.TableColumn EmailColumn
        {
            get { return Schema.Columns[11]; }
        }
        
        
        
        public static TableSchema.TableColumn CreatedOnColumn
        {
            get { return Schema.Columns[12]; }
        }
        
        
        
        public static TableSchema.TableColumn PasswordColumn
        {
            get { return Schema.Columns[13]; }
        }
        
        
        
        public static TableSchema.TableColumn SaltColumn
        {
            get { return Schema.Columns[14]; }
        }
        
        
        
        public static TableSchema.TableColumn PasswordFormatColumn
        {
            get { return Schema.Columns[15]; }
        }
        
        
        
        #endregion
		#region Columns Struct
		public struct Columns
		{
			 public static string UserId = @"UserId";
			 public static string Name = @"Name";
			 public static string LastLockedOutDate = @"LastLockedOutDate";
			 public static string IsLockedOut = @"IsLockedOut";
			 public static string PasswordQuestion = @"PasswordQuestion";
			 public static string PasswordAnswer = @"PasswordAnswer";
			 public static string Comment = @"Comment";
			 public static string LastPasswordChangedDate = @"LastPasswordChangedDate";
			 public static string IsApproved = @"IsApproved";
			 public static string LastLoginDate = @"LastLoginDate";
			 public static string LastActivityDate = @"LastActivityDate";
			 public static string Email = @"Email";
			 public static string CreatedOn = @"CreatedOn";
			 public static string Password = @"Password";
			 public static string Salt = @"Salt";
			 public static string PasswordFormat = @"PasswordFormat";
						
		}
		#endregion
		
		#region Update PK Collections
		
        public void SetPKValues()
        {
                if (colUserInGroupRecords != null)
                {
                    foreach (Medianamik.Core.DAL.SubSonicDAL.UserInGroup item in colUserInGroupRecords)
                    {
                        if (item.UserId != UserId)
                        {
                            item.UserId = UserId;
                        }
                    }
               }
		}
        #endregion
    
        #region Deep Save
		
        public void DeepSave()
        {
            Save();
            
                if (colUserInGroupRecords != null)
                {
                    colUserInGroupRecords.SaveAll();
               }
		}
        #endregion
	}
}
